package com.boomsecret.pattern.proxy;

/**
 * Created by wangjinliang on 2018/1/17.
 */
public class UserStaticProxy implements IUserDao {

    private IUserDao userDao = null;

    public UserStaticProxy(IUserDao userDao) {
        this.userDao = userDao;
    }


    @Override
    public void saveUser(User user) {
        System.out.println("Proxy saveUser before.");
        userDao.saveUser(user);
        System.out.println("Proxy saveUser after.");
    }

    @Override
    public int updateUser(User user) {
        System.out.println("Proxy updateUser before.");
        int affectRecords = userDao.updateUser(user);
        System.out.println("Proxy updateUser after.");
        return affectRecords;
    }
}
